package com.gang.ssm.bos.system.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gang.ssm.bos.core.toolbox.ajax.AjaxResult;
import com.gang.ssm.bos.system.bean.City;
import com.gang.ssm.bos.system.service.CityService;


@Controller
@RequestMapping("/city")
public class CityController extends BosController {
	
	@Autowired
	private CityService cityService;
	
	@ResponseBody
	@RequestMapping("/findCitiesByProvinceId")
	public AjaxResult findCitiesByProvinceId(Integer provinceId) {
		try {
			List<City> cities = cityService.findAllByProvinceId(provinceId);
			return success(cities);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return fail("获取城市失败!");
	}

}
